package main

import "fmt"

type Component interface {
	Operation()
}

type ConcreteComponent struct{}

func (c *ConcreteComponent) Operation() {
	fmt.Println("ConcreteComponent: performing basic Operation")
}

type Decorator struct {
	component Component
}

func (d *Decorator) Operation() {
	if d.component != nil {
		d.component.Operation()
	}
}

type ConcreteDecoratorA struct {
	Decorator
}

func (d *ConcreteDecoratorA) Operation() {
	d.Decorator.Operation()
	fmt.Println("ConcreteDecoratorA: adding additional behavior")
}

func main() {
	// Create a concrete component
	component := &ConcreteComponent{}

	// Create a concrete decorator
	decoratorA := &ConcreteDecoratorA{Decorator{component: component}}

	// Perform the operation
	decoratorA.Operation()

	// Output:
	// ConcreteComponent: performing basic Operation
	// ConcreteDecoratorA: adding additional behavior

}
